/*************************************************************************
 > File Name: monolith/interface/inference/model.h
 > Author: dzhang
 > Mail: dong.zhang@ingenic.com
 > Created Time : Sun 17 Jan 2021 09:49:24 PM CST
 > Description:
 ************************************************************************/

#ifndef _MONOLITH_INTERFACE_INFERENCE_MODEL_H
#define _MONOLITH_INTERFACE_INFERENCE_MODEL_H
#pragma once
#include <iostream>
#include <vector>
#include <memory>
#include "monolith/core/macros.h"
#include "MNN/Interpreter.hpp"
#include "MNN/MNNDefine.h"
#include "MNN/Tensor.hpp"
#include "MNN/ImageProcess.hpp"

CC_NAME_SPACE_BEGIN

namespace inference {

struct ModelParameter {
    std::string model_path_;
    std::string name_;
    int input_height_;
    int input_width_;
    int input_channel_;
    std::vector<float> mean_;
    std::vector<float> var_;
    int num_thread_ = 4;
};

class Model {
public:
    Model() = delete;
    Model(ModelParameter model_parameter);
    ~Model();

protected:
    int init_model();

protected:
    ModelParameter model_parameter_;
    std::shared_ptr<MNN::Interpreter> model_interpreter_;
    MNN::Session *model_session_ = nullptr;
    MNN::Tensor *input_tensor_ = nullptr;

};

} // namespace inference
CC_NAME_SPACE_END

#endif //MONOLITH_INTERFACE_INFERENCE_MODEL_H
